<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>模型管理</title>
    <link rel="stylesheet" href="/activiti/ui/plugins/layui/css/layui.css" media="all">
</head>
<body>
<div style="margin: 15px;">
    <form class="layui-form" action="#" id="add_model_form">
        <div class="layui-form-item">
            <label class="layui-form-label">模型编码<span style="color: red">&nbsp;*</span></label>
            <div class="layui-input-block">
                <input type="text" name="key" lay-verify="required|name" lay-verify-max="32" autocomplete="off" placeholder="模型编码"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">模型名称<span style="color: red">&nbsp;*</span></label>
            <div class="layui-input-block">
                <input type="text" name="name" lay-verify="required" lay-verify-max="32" autocomplete="off" placeholder="模型名称"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属系统<span style="color: red">&nbsp;*</span></label>
            <div class="layui-input-block">
                <input type="text" name="belongSystem" lay-verify="required" lay-verify-max="32" autocomplete="off" placeholder="所属系统"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label">业务线<span style="color: red">&nbsp;*</span></label>
            <div class="layui-input-block" id="businessDiv">
                <select id="businessId" name="businessId">
                    <option>请选择</option>
                    <option value="1">房贷</option>
                    <option value="2">车贷</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">模型描述</label>
            <div class="layui-input-block">
                <textarea name="description" placeholder="请输入内容"  lay-verify-max="255" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo" >提交
                </button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>

        <button lay-filter="edit" lay-submit style="display: none;"></button>
    </form>
</div>
<script src="/activiti/ui/plugins/layui/layui.js"></script>
<script src="/activiti/ui/src/js/model/model_config.js"></script>
<script src="/activiti/ui/src/js/model/model.js"></script>
<script>

    layui.config({
        base: '/activiti/ui/src/js/modules/' //假设这是你存放拓展模块的根目录
    }).extend({ //设定模块别名
        myutil: 'common' //如果 mymod.js 是在根目录，也可以不用设定别名
    });

    layui.use(['form', 'jquery','myutil'], function(){
        var form = layui.form;
        var $ = layui.jquery;
        var myutil = layui.myutil;
        myutil.business.init('category',$("#businessDiv"),"category");

        form.on('submit(formDemo)', function(data){
            $.ajax({
                cache : true,
                type : "GET",
                url : pathConfig.activitiServicePath+'addModeler',
                data : data.field,// 你的formid
                async : false,
                error : function(request) {
                    layer.msg("保存失败！");
                },
                success : function(data) {
                    if(data.code == 0){
                        parent.layer.closeAll();//关闭弹出的子页面窗口
                        var layIndex = parent.layer.open({
                            type: 2,
                            shade: false,
                            title:false,
                            content: pathConfig.activitiUiPath+'modelEdit?modelId='+data.data.modelId+"&date="+new Date(),
                            zIndex: layer.zIndex, //重点1
                            success: function(layero){
                                layer.setTop(layero); //重点2
                            }
                        });
                        parent.layer.full(layIndex);
                    }
                }
            });
            return false;
        });


    });

</script>
</body>
</html>